Research: Cloning MIFARE Classic 1k Cards

GitHub: Cloning MIFARE Classic

Legal Disclaimer:
This guide is intended solely for educational purposes and for use in authorized security testing. Any unauthorized use, cloning, or tampering with RFID systems is illegal and unethical. Always obtain proper authorization before performing any penetration tests.

In today's threat landscape, legacy RFID systems, particularly the MIFARE Classic 1K, continue to remain prevelant despite decades of known vulnerabilities. This guide distills both theoretical and hands-on expertise into a technical walkthrough for extracting authentication keys and either emulating or cloning these cards. It covers historical context, inherent vulnerabilities, advanced attack methodologies, and defensive mitigations.

Note: MIFARE Classic 1K cards operate at 13.56 MHz


Summary

This guide provides a comprehensive overview of techniques for cloning MIFARE Classic 1K cards, a legacy RFID technology still widely deployed despite its vulnerabilities. It details the process of extracting authentication keys and emulating or cloning the card using tools like the Flipper Zero and custom firmware. Additionally, it discusses alternative tools such as the Proxmark3 for handling specific scenarios (e.g., “Static Encrypted” cards), outlines multiple attack methodologies, and recommends robust mitigation strategies.

Key Highlights:


1. Background: MIFARE Classic 1K Technology

MIFARE is a series of integrated circuit (IC) chips used in contactless smart cards and proximity cards. The brand includes proprietary solutions based on various levels of the ISO/IEC 14443 Type-A 13.56 MHz contactless smart card standard. It uses AES and DES/Triple-DES encryption standards, as well as an older proprietary encryption algorithm, Crypto-1. According to NXP, 10 billion of their smart card chips and over 150 million reader modules have been sold.

The MIFARE Classic IC is a basic memory storage device, where the memory is divided into segments and blocks with simple security mechanisms for access control. They are ASIC-based and have limited computational power. Due to their reliability and low cost, those cards are widely used for electronic wallets, access control, corporate ID cards, transportation or stadium ticketing. It uses an NXP proprietary security protocol (Crypto-1) for authentication and ciphering.

The MIFARE Classic with 1K memory offers 1,024 bytes of data storage, split into 16 sectors; each sector is protected by two different keys, called A and B. Each key can be programmed to allow operations such as reading, writing, increasing value blocks, etc.

MIFARE Classic 1K cards operate at 13.56 MHz and are divided into 16 sectors, each typically comprising 4 blocks (with block 0 reserved for the immutable Unique Identifier (UID) and manufacturer data). Authentication relies on the proprietary CRYPTO1 algorithm. Over time, extensive research has exposed several weaknesses:

Security Controls & Mitigations:


2. Required Tools


3. Step-by-Step Process

Step 1: Identify the Card

Objective:

Confirm that the target is a MIFARE Classic 1K (or variant) and gather initial intelligence.

drawing drawing

Methodology:


Step 2: Recovering the Keys

The aim is to recover the secret keys from each sector. Without these keys, the card reader’s authentication handshake will fail, preventing access to the card’s data.

2.1 Dictionary Attack

Rationale:

Many cards utilize default or commonly reused keys. A dictionary attack leverages a precompiled list of these keys to authenticate sectors.

Procedure:
  1. Initiate the NFC Read: Position your Flipper Zero near the card and activate the NFC “Read” function.
  2. Automated Key Testing: The device cycles through a dictionary of known default keys and any previously captured keys.
  3. Validation:
    • For standard cards, a successful read reveals all 16 sectors with valid keys.
    • For extended variants (e.g., MIFARE Classic EV1), all corresponding keys must be recovered.
Considerations:

2.2 Mfkey32 Attack

Rationale:

When the dictionary attack is only partially successful, the Mfkey32 method captures cryptographic nonces during the reader’s handshake and processes them—often via a combination of statistical and brute-force methods—to deduce additional keys.

Mechanics & Justification:
Procedure:
  1. Reader Interaction:
    • On your Flipper Zero, navigate to NFC → Detect Reader (labeled “Extract MF Keys” in OFW 1.0.0).
    • Hold the device near the operational reader.
  2. Nonce Collection:
    • If the reader’s handshake is disrupted by weak UID checks or other flaws, it will emit nonces.
  3. Key Extraction:
    • Computer-Based: Connect via USB-C, access Flipper Lab, and use the “GIVE ME THE KEYS” option or run mfkey32v2 from GitHub.
    • Mobile App: Utilize the Flipper Mobile App (iOS/Android) over Bluetooth to execute the Mfkey32 attack.
    • On-Device Execution: Launch the MFKey app from the Flipper Zero main menu (if memory issues occur, a reboot may help).
  4. Reevaluation: Re-scan the card with newly recovered keys to unlock additional sectors.

2.3 Nested Attack

Rationale:

A Nested attack takes advantage of partially authenticated sessions and previously obtained keys by leveraging residual nonces from earlier interactions to unlock remaining sectors.

Procedure:
  1. Install FlipperNested: Download the FlipperNested app from the App Hub on the Flipper Mobile App.
  2. Follow the Guide: Refer to detailed instructions on the FlipperNested Wiki for optimal positioning and data capture.
  3. Attack Variants:
    • Static Nested Attack: Effective when nonces remain constant; can be run on-device or using FlipperNestedRecovery on a PC.
    • Full/Hard Nested Attack: Requires more data and computational power, best performed on a computer.
  4. Analysis:
    • If additional keys are found, reinitiate the scan.
    • For “Static Encrypted” cards, consider using specialized tools (e.g., a Proxmark3 running the run fm11rf08s_recovery script).

2.4 KDF Attack

Rationale:

Some card manufacturers employ specific key derivation functions (KDFs) that can be exploited via dedicated plugins, allowing for rapid key recovery when vulnerabilities exist.

Procedure:
  1. Download Plugins: Visit the Flipper KDF GitHub page and download the latest plugins.zip.
  2. Deploy Plugins: Extract the .fal files and copy them to the SD card directory at /apps_data/nfc/plugins/.
  3. Rescan the Card: Use the NFC app on your Flipper Zero to re-scan the card; the plugins will attempt to derive any missing keys.
  4. Verification:
    • Success is achieved when all expected keys (e.g., 32/32 for a standard layout) are recovered.

Note: If certain keys remain elusive, revert to the Mfkey32 method. Currently, there is no known process to crack the residual keys without further exploiting system vulnerabilities.


Step 3: Emulation and Cloning

After successfully extracting all sector keys, you can proceed to either emulate the card using the Flipper Zero or clone its data onto a physical “magic” card.

Emulation

  1. Load the Card Profile:
    • Navigate to NFC → Saved → [Your Card’s Name] on the Flipper Zero.
  2. Initiate Emulation:
    • Select Emulate and hold the device near the target reader.
  3. Troubleshooting:
    • If the emulated card is rejected—often due to timing issues—upgrade your Flipper Zero firmware to version 0.94.0 or later, which includes an improved NFC stack. (Note: Some tools like FlipperNested might not support firmware above 0.93.0 yet.)

Cloning to a Physical Card

  1. Select a Magic Card:
    • For a 4-byte UID: Choose Gen1a or Gen2 Magic Cards (4-byte UID variant).
    • For a 7-byte UID: Opt for Gen2 (7-byte UID variant) or Gen4/Ultimate Magic Cards.
  2. Clone the Data:
  3. Verification:
    • Test the cloned card on the original reader. Note that some advanced readers may implement countermeasures to detect cloned or “magic” cards.

4. Final Thoughts and Mitigation Strategies

Cloning MIFARE Classic 1K cards starkly exposes the vulnerabilities inherent in legacy access control systems. While the techniques described here mirror the current state-of-the-art in penetration testing, they also serve as a call to action for better security measures.

Recommendations:

Ethical Reminder:
This guide is provided for educational purposes and authorized security testing only. Unauthorized cloning or tampering with RFID systems is both illegal and unethical.

By integrating these insights and best practices, security professionals can significantly bolster the resilience of access control systems against modern threats.

Additional reading and sources



Tags: Radio, RFID, Vulnerability, Research, FilpperZero, Featured

← Back home